package org.luxor.cloud.users.controller;

import org.luxor.commons.core.web.controller.BaseRestController;
import org.luxor.commons.core.web.data.R;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;


/**
 * 认证用户详情信息
 *
 * @author Mr.Yan  @date: 2020/10/11
 */

@RestController
public class TestController extends BaseRestController {

    @Value("${server.port}")
    private String port;

    @GetMapping("/info")
    public R<String> info() {
        return R.ok(port);
    }

    @PostMapping("/add")
    public R<Map> add(@RequestBody Map<String, String> map) {
        return R.ok(map);
    }

    @GetMapping("/fault")
    //@PreAuthorize("isAuthenticated() or #oauth2.hasAnyScope('user_details')")
    public R<String> fault() {
        return R.failed("错误异常");
    }

}
